//
//  ViewController.m
//  who you are 16.3.3
//
//  Created by zhangxin on 16/3/3.
//  Copyright © 2016年 zhangxin. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *myImageView;
- (IBAction)randhero;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)randhero
{
    //1。获取一个1到24的随机数
    int imageId = arc4random()%24+1;
    //2.创建图片名字字符串
    NSString * imageName = [NSString stringWithFormat:@"%d.jpg",imageId];
    //3.加载随机图片到imageView控件上
    self.myImageView.image = [UIImage imageNamed:imageName];
}
@end
